 #ifndef PAINTAREA_H
 #define PAINTAREA_H

 #include <QColor>
 #include <QImage>
 #include <QPainterPath>
#include <QPainter>
 #include <QWidget>
#include <QMouseEvent>
#include <QGraphicsScene>
#include <QGraphicsView>
#include "ImageStore.h"
#include <QGraphicsPixmapItem>
#include "Canvas.h"
#include "CanvasView.h"
 class BrushInterface;

 class PaintArea : public QGraphicsView
 {
     Q_OBJECT

 public:
		~PaintArea();
	PaintArea(QWidget *parent = 0);
	bool openImage(const QString &fileName);
	bool saveImage(const QString &fileName, const char *fileFormat);
	void insertShape(const QPainterPath &path);
	void resizeImage( QSize);
	void undo();
	void redo();
	void saveUndoState();
	void cleanUndoStack();
	void updateImage(QImage image){this->image = image;updatePixmap();}
	int getUndoPointer() const {return undoPointer;}
	QPoint getLastPoint(){return lastPoint;}
	void setLastPoint(QPoint newPoint) {lastPoint = newPoint;}
	void updatePixmap();
	void setPixmap(QGraphicsPixmapItem* sourcePixmap){currentPixmap = sourcePixmap;updatePixmap();};
	void setScribbling(bool value){scribbling = value;}
	void setImage(QImage* sourceImage);
	QImage* getImage(){return &image;};

 protected:
	virtual void mousePressEvent(QMouseEvent*);
	virtual void mouseMoveEvent(QMouseEvent*);
	virtual void mouseReleaseEvent(QMouseEvent*);
	 
 public:
	 
	 int currentZoomLevel;
	 int undoPointer;
     bool modified;
     bool scribbling;
     QImage image;
	 QGraphicsPixmapItem* currentPixmap;
	 static ImageStore* imageStore;
	 Canvas* ourCanvas;
     QPoint lastPoint;
	 std::vector<QImage*> undoVector;

 };

 #endif